GBML manual / Tweens

tween_stop

Stops the glide on a variable and leaves it exactly where it has got to. Does nothing if that variable is not gliding.

Works differently on Game Boy - The Game Boy glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

Works differently on Game Boy Color - The Game Boy Color glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

tween_stop(target)

Arguments

NameType
targetfield

Returns

Nothing.

Description

Stops the glide on a variable and leaves it exactly where it has got to. It does not jump to the end and it does not go back to the start. If the variable is not gliding, nothing happens.

Example

if (pos_meeting(x, y, obj_doc_wall)) {
    tween_stop(x);
}

A walker that slides to the right stops dead the moment it touches a wall, wherever the glide had got to. Its place goes back to the engine at once, so tween_count drops by one.

Good to know

On the GBA

Gives its place back at once (tween_count() goes down by one). The variable keeps whatever value it had this frame - it does not jump to the end value, and it does not go back to the start. To make it jump to the end, set it yourself after the stop. A destroyed instance has no glide to stop and this does nothing.

See also: Tweenstween_totween_runningtween_count